import { Tree } from "antd";
import { useComponetsStore } from "../../store/components";

export default function Outline() {
	const { components, setCurComponentId } = useComponetsStore();

	return (
		<Tree
			fieldNames={{ title: "desc", key: "id" }}
			treeData={components as any}
			showLine
			defaultExpandAll
			onSelect={([selectedKey]) => {
				setCurComponentId(selectedKey as number);
			}}
		/>
	);
}
